<template>
  <div class="home-banner">
    <el-carousel height="500px">
      <el-carousel-item v-for="item in bannerList" :key="item">
        <img :src="item.imgUrl" alt="" />
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script setup>
import { getBannerApi } from '@/apis/home'
import { ref } from 'vue'

const bannerList = ref([])
const getBanner = async () => {
  const { result } = await getBannerApi()
  bannerList.value = result
}

getBanner()
</script>

<style lang="scss" scoped>
.home-banner {
  width: 100%;
  position: absolute;
  left: 0;
  top: 0;
  img {
    width: 100%;
    height: 100%;
  }
}

.el-carousel__item h3 {
  color: #475669;
  opacity: 0.75;
  line-height: 150px;
  margin: 0;
  text-align: center;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
</style>
